package com.ifeng.stock;

import java.io.UnsupportedEncodingException;

import com.tidemark.Consts;
import com.tidemark.DefaultDataModel;
import com.tidemark.Proposal;
import com.tidemark.Stock;
import com.tidemark.StockDataModel;

public class RelativeReader extends AbstractReader implements com.tidemark.Reader {
	
	public Proposal comment(Proposal input){
		throw new RuntimeException("not implemented yet");
	}
	
	public Proposal propose(){
		
		model.removeAll();
		
		try {
			//System.out.println(":)   :)   :)   ifeng.com ");
			compare_print(read(Constants.bigindelta), read(Constants.smalloutdelta), new String(Constants.NIU, "utf-8"), Consts.BUY);
			//System.out.println(":(   :(   :(   ifeng.com ");
			compare_print(read(Constants.bigoutdelta), read(Constants.smallindelta), new String(Constants.XIONG, "utf-8"), Consts.SALE);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return new Proposal(this, this.model, null);
	}

	public RelativeReader(StockDataModel model){
		if(model == null){
			throw new NullPointerException("stock data model must not be null.");
		}
		this.model = model;
	}
	
	public RelativeReader(){
		this.model = new DefaultDataModel();
	}
}
